export function refreshTokenPost(api) {
  // 判断是否需要刷新token
  const tokenTime = sessionStorage.getItem("tokenTime")
  // 计算token的相差时间
  const differenceInMilliseconds = Math.abs(Date.now() - tokenTime);
  // 将毫秒差转换为分钟
  const differenceInMinutes = differenceInMilliseconds / (1000 * 60);
  if (differenceInMinutes<=30) {
    return
  }
    api({
        url:  '/setting/user/refresh/',
        method: 'post',
      }).then((res) => {
        // 存储token获取的时间
        sessionStorage.setItem("tokenTime", Date.now())
        sessionStorage.setItem("token", res.data.token)
      })
      .catch((err) => {
        
      })
  }